package bankingSystemServer;

import java.util.Vector;

/**
 * holds customer information
 */
public class Customer extends User {
	Vector<Account> accounts;

	/**
	 * creates a new Customer
	 * 
	 * @param name
	 */
	public Customer(String name, String password) {
		super(name, password);
		accounts = new Vector<Account>();
	}

	public Vector<Account> getAccounts() {
		return accounts;
	}

	public boolean hasAccount(String accountNumber) {
		for (Account account : accounts) {
			if (account.getAccountNumber().equals(accountNumber)) {
				return true;
			}
		}
		return false;
	}

	public Vector<AccountInfo> getUserAccounts() {
		Vector<AccountInfo> accountInfos = new Vector<AccountInfo>();
		for (Account account : accounts) {
			accountInfos.add(account.getAccountInfo());
		}
		return accountInfos;
	}

	public void addAccount(Account newAccount) {
		accounts.add(newAccount);
	}
}
